perm filename DUMPER.PAS[PAS,SYS] blob sn#472151 filedate 1979-09-12 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	(*$e+,t-,d-*)
C00009 ENDMK
C⊗;
(*$e+,t-,d-*)
PROGRAM dumper, dpcnts, inittiming, timeit;
    (**********************************************************************
     *
     *  (C) COPYRIGHT  1979
     *          BOARD OF TRUSTEES
     *          LELAND STANFORD JUNIOR UNIVERSITY
     *              STANFORD, CA. 94305, U. S. A.
     *
     *      (C) COPYRIGHT 1979,
     *          ARMANDO R. RODRIGUEZ
     *              LOTS COMPUTER FACILITY
     *              STANFORD UNIVERSITY
     *              STANFORD, CA. 94305, U. S. A.
     *
     *      AUXILIARY ROUTINES FOR STATEMENT COUNTS (PROFILE)
     *      AS IMPLEMENTED BY PHILIP WISOFF, FEB-79
     *	    modified by armando r. rodriguez, sep-79: support timing of 
     *		basic blocks (monitor) and procedures (profile) and
     *		reduce the size of the .KNT file.
     *
     *      DPCNTS:
     *              DUMPS TO A FILE OF INTEGER THE LINE/PAGE MARKERS AND
     *              THE COUNTS FOR EACH BASIC BLOCK.
     *
     *********************************************************************)

TYPE
	linerange = 0..777777B;
	pagerange = 0..377777B;
	data = PACKED RECORD
			  line: linerange;
			  timerflag: boolean;
			  page: pagerange;
			  count: integer;
		      END;
    dfiletype = FILE OF data;
    packed9 = PACKED ARRAY [1..9] OF char;
    pointer = ↑integer;
    hack = record
	case boolean of
	   true: (val: integer);
	   false: (ptr: pointer);
	   end;

VAR
    dumpfile : dfiletype;
   globtime,
   thistime, lasttime: integer;
   lastaddress: pointer;
   reg1: hack;

PROCEDURE dpcnts (filename : packed9;startofcounts,endofcounts : integer);

    TYPE
	pointer = RECORD
		      CASE boolean OF
			   true : (location : ↑data);
			   false : (incloc : linerange);
		  END;
    VAR
	dataptr : pointer;
	countdata : data;

    BEGIN (*DPCNTS*)
    rewrite(dumpfile,filename);             (*OPEN THE FILE*)
    WITH dataptr DO BEGIN
	dataptr.incloc := startofcounts;
	WHILE dataptr.incloc <= endofcounts DO  (*FOR EACH COUNT MARKER*)
	    BEGIN
	    %3
	    with location↑ do			(*at sail, we get microseconds*)
		if timerflag then
		count := (count + 5) div 10;
		\
		dumpfile↑ := location↑;
		put(dumpfile);
	    dataptr.incloc := dataptr.incloc + 2;   (*AND GO TO THE NEXT*)
	    END;
	END;
    reset(dumpfile,filename);                       (*CLOSE THE FILE*)
    %3 message('to produce the profile listing, .r pcref');	\
    END;

BEGIN
END.